/** @var bool */
protected $hasSha1Storage = false;
+ /** @var bool */
+ protected $supportsSha1URLs = false;
+
/** @var FileBackend */
protected $backend;
$this->zones[$zone]['urlsByExt'] = array();
}
}
+
+ $this->supportsSha1URLs = !empty( $info['supportsSha1URLs'] );
}
/**
public function hasSha1Storage() {
return $this->hasSha1Storage;
}
+
+ /**
+ * Returns whether or not repo supports having originals SHA-1s in the thumb URLs
+ * @return boolean
+ */
+ public function supportsSha1URLs() {
+ return $this->supportsSha1URLs;
+ }
}
/**
* @ingroup FileRepo
*/
class LocalRepo extends FileRepo {
- /** @var bool */
- protected $hasSha1Storage = false;
-
/** @var array */
protected $fileFactory = array( 'LocalFile', 'newFromTitle' );
$extension = $this->getExtension();
list( $thumbExt, ) = $this->getHandler()->getThumbType(
$extension, $this->getMimeType(), $params );
- $thumbName = $this->getHandler()->makeParamString( $params ) . '-' . $name;
- if ( $thumbExt != $extension ) {
- $thumbName .= ".$thumbExt";
+ $thumbName = $this->getHandler()->makeParamString( $params );
+
+ if ( $this->repo->supportsSha1URLs() ) {
+ $thumbName .= '-' . $this->getSha1() . '.' . $thumbExt;
+ } else {
+ $thumbName .= '-' . $name;
+
+ if ( $thumbExt != $extension ) {
+ $thumbName .= ".$thumbExt";
+ }
}
return $thumbName;